package practice;


import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class X_Y_Z {
    public static void main(String[] args) {
        compare();
    }
    public static void compare(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter three integers (space-separated):");

        // Use Stream API to read and sort numbers
        int[] numbers = IntStream.range(0, 3) // Create a stream of indices [0, 1, 2]
                .map(i -> scanner.nextInt())      // Map each index to an integer input
                .sorted()                         // Sort the stream of inputs
                .toArray();                       // Collect results into an array

        // Print sorted numbers using Stream API
        System.out.println("Numbers sorted from smallest to largest:");
        Arrays.stream(numbers)                  // Convert array to stream
                .forEach(n -> System.out.print(n + " ")); // Print each number followed by a space

        System.out.println(); // Move to the next line
        scanner.close();
    }
}
